// 函数
export function sum(a: number, b: number): number {
    return a + b;
}

// 返回对象
export function getObject(name: string, age: number): Object {
    return {
        name,
        age
    }
}


// 回调
export const getDataCallback = (fn:Function) => {
    setTimeout(() => {
        fn({ name: 'callback' })
    }, 1000);
}


// promise
export const getDataPromise = () => {
    return new Promise((resolve, reject) => {
        setTimeout(() => {
            resolve({ name: 'callback' })
        }, 1000);
    })
}

export default {
    sum,
    getObject,
    getDataCallback,
    getDataPromise

}
